﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MS.InformationManagement.Presenter.Support;

namespace MS.InformationManagement.Presenter.ExpedientesView
{
    public class ExpedientesListPresenter : BasePresenter<IExpedientesListView>
    {

        #region Constructors

        public ExpedientesListPresenter(IExpedientesListView view) : base(view) { }

        #endregion

        #region Public Methods

        public void HandleLoad()
        {
            var businessObject = new BLL.TRDSelector.TRDSelector();
            View.Series = businessObject.GetSeries();
            View.TiposDocumentales = businessObject.GetAllDocumentalTypes();
            View.Show();
        }

        public void HandleGetSubseries()
        {
            View.Subseries = new BLL.TRDSelector.TRDSelector().GetSubSeries(View.SelectedSerie);
            View.LoadSubSeries();
        }

        public void HandleSearch()
        {
            int totalRecords;
            View.Expedientes = new BLL.ExpedientesList.ExpedienteList().SearchExpediente(View.SelectedRadicado, View.SelectedSerie, View.SelectedSubSerie, View.InitialDate, View.EndDate, View.PageIndex, View.PageSize, out totalRecords);
            View.TotalRecords = totalRecords;
            View.LoadSearch();
        }

        #endregion

    }
}
